package anno;

import java.lang.annotation.Annotation;

/**
 * @Author wangzhipeng
 * @Date 2020-08-14 7:20 下午
 * @Description 使用注解，通过反射方式获取注解参数
 */
@Demo(number = 1,value = "hello")
public class UserDamoAnno {
    public static void main(String[] args) {
        Class<UserDamoAnno> userDamoAnnoClass = UserDamoAnno.class;
        Annotation[] annotations = userDamoAnnoClass.getAnnotations();
        for(Annotation annotation:annotations){
            System.out.println(annotation.toString());
        }

        Demo annotation = userDamoAnnoClass.getAnnotation(Demo.class);
        System.out.println(annotation.number());
        System.out.println(annotation.value());

    }
}
